package com.yan.config;

import com.yan.Viewer;
import com.yan.configSource.ConfigSource;
import com.yan.Updater;

import java.util.Map;

/**
 * @author yanheng
 * @data 2020/1/2 18:22
 */
public class RedisConfig implements Updater, Viewer {
    private ConfigSource configSource;
    private String address;
    private int timeout;
    private int maxTotal;
    //省略其他配置: maxWaitMillis,maxIdle,minIdle...

    public RedisConfig(ConfigSource configSource){
        this.configSource = configSource;
    }

    @Override
    public void update() {
        //从configSource加载配置到address/timeout/maxTotal...
    }

    public ConfigSource getConfigSource() {
        return configSource;
    }

    public void setConfigSource(ConfigSource configSource) {
        this.configSource = configSource;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public int getTimeout() {
        return timeout;
    }

    public void setTimeout(int timeout) {
        this.timeout = timeout;
    }

    public int getMaxTotal() {
        return maxTotal;
    }

    public void setMaxTotal(int maxTotal) {
        this.maxTotal = maxTotal;
    }

    @Override
    public String outputInPlainText() {
        return null;
    }

    @Override
    public Map<String, String> output() {
        return null;
    }
}
